{extend name="admin@index_layout"/}
{block name="main"}
<!--<style type="text/css">-->
<!--    .layui-table-cell{-->
<!--        height: auto!important;-->
<!--        white-space: normal;-->
<!--    }-->
<!--</style>-->

<div class="layui-card">
    <div class="layui-card-header">员工列表</div>
    <div class="layui-card-body">
        <table class="layui-hide" id="currentTable" lay-filter="currentTable"
               data-auth-add="{:$auth->check('member2.member/add')}"
               data-auth-edit="{:$auth->check('member2.member/edit')}"
               data-auth-delete="{:$auth->check('member2.member/del')}"
        ></table>
    </div>
</div>

<script type="text/html" id="picTpl">

    <img style="max-Width:80px; max-height:30px;" src="{{d.avatarUrl}}" data-image="{{d.nickname}}">

</script>

<script type="text/html" id="barTool">
    {{# if(d.status==1){ }}
    <a href="javascript:;" onclick="wk.confirm('{{d.id}}','{:url('edit')}','确定关闭账户吗？')"
       class="layui-btn layui-btn-danger layui-btn-xs" title="冻结账户">关闭账户</a>
    {{# } }}
    {{# if(d.status==0){ }}
    <a href="javascript:;" onclick="wk.confirm('{{d.id}}','{:url('edit')}','确定开通账户吗？')" class="layui-btn  layui-btn-xs"
       title="解锁账户">开通账户</a>
    {{# } }}

    <a class="layui-btn layui-btn-xs" data-open='{:url("edit2")}?id={{ d.id }}' data-title="编辑"
    >编辑</a>

    <!--    <a class="layui-btn layui-btn-xs" data-open='{:url("recharge")}?id={{ d.id }}' data-title="充值"-->
    <!--    >充值</a>-->
    <!--    <a class="layui-btn layui-btn-xs layui-btn-normal" data-open='{:url("recharge2")}?id={{ d.id }}' data-title="充值"-->
    <!--    >充值</a>-->
    <a data-open='{:url("funtlist")}?sale_id={{d.id }}'
       class="layui-btn layui-btn-xs layui-btn-warm"
       title="余额明细" data-full="true">余额明细</a>


    <!--<a class="layui-btn layui-btn-xs" data-open='{:url("recharge")}?id={{ d.id }}' data-title="充值"-->
    <!--   data-full="true">充值</a>-->


    <!--    {{# if(d.is_manage==0){ }}-->
    <!--    <a href="javascript:;" onclick="wk.confirm('{{d.id}}','{:url('manage')}','确定设为管理员吗？')" class="layui-btn  layui-btn-xs" title="设为管理员">设为管理员</a>-->
    <!--    {{# } }}-->
    <!--    {{# if(d.is_manage==1){ }}-->
    <!--    <a href="javascript:;" onclick="wk.confirm('{{d.id}}','{:url('manage')}','确定取消管理员吗？')" class="layui-btn layui-btn-danger layui-btn-xs" title="取消管理员">取消管理员</a>-->
    <!--    {{# } }}-->
</script>

<!--操作模板-->

{/block}
{block name="script"}


<script>
    layui.use('yznTable', function () {
        var table = layui.yznTable;
        var init = {
            table_elem: '#currentTable',
            table_render_id: 'currentTable',
            add_url: "{:url('add')}",
            edit_url: "{:url('edit')}",
            delete_url: "{:url('del')}",
        };

        table.render({
            init: init,
            autowidth: true,
            // toolbar: ['refresh','add','delete'],
            toolbar: ['refresh', 'add'],
            url: '{:url("index")}',
            cols: [
                [
                    //昵称 nickname
                    // 头像 avatarUrl
                    // openid
                    // 手机号 mobile
                    // 性别 gender '性别:0=未知,1=男,2=女',
                    // 注册ip reg_ip
                    // 账号状态 status
                    // 创建时间 create_time
                    {type: 'checkbox', fixed: 'left'},
                    {field: 'id', width: '8%', align: "center", title: 'ID'},
                    {field: 'name', width: '10%', align: "center", title: '姓名', searchOp: 'like'},
                    {field: 'no', width: '10%', align: "center", title: '工号'},
                    {field: 'username', width: '10%', align: "center", title: '登录账号'},
                    // { field: 'avatarUrl', width: '8%', align: "center",title: '图片', search: false, templet: '#picTpl' },
                    // { field: 'openid', width: '25%',align: "center", title: 'openid',search: false},
                    {
                        field: 'type', width: '8%', align: "center", title: '职务类型', templet: function (d) {
                            if (d.type == 1) {
                                return '<span style="color: green">全职</span>';
                            } else {
                                return '<span style="color: #0000FF">兼职</span>';
                            }
                        }, selectList: {1: '全职', 2: '兼职'}
                    },
                    {field: 'phone', width: '10%', align: "center", title: '联系电话',},
                    {field: 'top_info', width: '10%', align: "center", title: '上级经理', search: false},
                    {field: 'money', width: '8%', align: "center", title: '余额', search: false},
                    // { field: 'query_count', width: '8%',align: "center", title: '可用次数',search: false},
                    // { field: 'fraction', width: '6%',align: "center", title: '积分',search: false},


                    {
                        field: 'status', width: '8%', align: "center", title: '账号状态', templet: function (d) {
                            if (d.status == 0) {
                                return '<span style="color: red">账号关闭</span>';
                            } else {
                                return '<span style="color: green">账号开通</span>';
                            }
                        }, selectList: {0: '账号关闭', 1: '账号开通'}
                    },

                    {field: 'create_time', align: "center", width: '15%', title: '创建时间', search: 'range'},
                    {fixed: 'right', align: 'center', width: '20%', title: '操作', toolbar: '#barTool'}//delete'
                ]
            ],
            page: {}
        });
        yznTable.bindevent();
        selectElement2 = document.getElementById('searchFieldset_currentTable');
        selectElement2.classList.remove("layui-hide");
    });
</script>
{/block}